
_swaptest:     file format elf32-i386


Disassembly of section .text:

00000000 <fmtname>:

/* coppied from ls.c */

char*
fmtname(char *path)
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	53                   	push   %ebx
   4:	83 ec 24             	sub    $0x24,%esp
	static char buf[DIRSIZ+1];
	char *p;

	// Find first character after last slash.
	for(p=path+strlen(path); p >= path && *p != '/'; p--)
   7:	8b 45 08             	mov    0x8(%ebp),%eax
   a:	89 04 24             	mov    %eax,(%esp)
   d:	e8 bc 05 00 00       	call   5ce <strlen>
  12:	8b 55 08             	mov    0x8(%ebp),%edx
  15:	01 d0                	add    %edx,%eax
  17:	89 45 f4             	mov    %eax,-0xc(%ebp)
  1a:	eb 04                	jmp    20 <fmtname+0x20>
  1c:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
  20:	8b 45 f4             	mov    -0xc(%ebp),%eax
  23:	3b 45 08             	cmp    0x8(%ebp),%eax
  26:	72 0a                	jb     32 <fmtname+0x32>
  28:	8b 45 f4             	mov    -0xc(%ebp),%eax
  2b:	0f b6 00             	movzbl (%eax),%eax
  2e:	3c 2f                	cmp    $0x2f,%al
  30:	75 ea                	jne    1c <fmtname+0x1c>
		;
	p++;
  32:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)

	// Return blank-padded name.
	if(strlen(p) >= DIRSIZ)
  36:	8b 45 f4             	mov    -0xc(%ebp),%eax
  39:	89 04 24             	mov    %eax,(%esp)
  3c:	e8 8d 05 00 00       	call   5ce <strlen>
  41:	83 f8 0d             	cmp    $0xd,%eax
  44:	76 05                	jbe    4b <fmtname+0x4b>
		return p;
  46:	8b 45 f4             	mov    -0xc(%ebp),%eax
  49:	eb 5f                	jmp    aa <fmtname+0xaa>
	memmove(buf, p, strlen(p));
  4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  4e:	89 04 24             	mov    %eax,(%esp)
  51:	e8 78 05 00 00       	call   5ce <strlen>
  56:	89 44 24 08          	mov    %eax,0x8(%esp)
  5a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  5d:	89 44 24 04          	mov    %eax,0x4(%esp)
  61:	c7 04 24 f8 11 00 00 	movl   $0x11f8,(%esp)
  68:	e8 eb 06 00 00       	call   758 <memmove>
	memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
  6d:	8b 45 f4             	mov    -0xc(%ebp),%eax
  70:	89 04 24             	mov    %eax,(%esp)
  73:	e8 56 05 00 00       	call   5ce <strlen>
  78:	ba 0e 00 00 00       	mov    $0xe,%edx
  7d:	89 d3                	mov    %edx,%ebx
  7f:	29 c3                	sub    %eax,%ebx
  81:	8b 45 f4             	mov    -0xc(%ebp),%eax
  84:	89 04 24             	mov    %eax,(%esp)
  87:	e8 42 05 00 00       	call   5ce <strlen>
  8c:	05 f8 11 00 00       	add    $0x11f8,%eax
  91:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  95:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
  9c:	00 
  9d:	89 04 24             	mov    %eax,(%esp)
  a0:	e8 50 05 00 00       	call   5f5 <memset>
	return buf;
  a5:	b8 f8 11 00 00       	mov    $0x11f8,%eax
}
  aa:	83 c4 24             	add    $0x24,%esp
  ad:	5b                   	pop    %ebx
  ae:	5d                   	pop    %ebp
  af:	c3                   	ret    

000000b0 <ls>:

void
ls(char *path)
{
  b0:	55                   	push   %ebp
  b1:	89 e5                	mov    %esp,%ebp
  b3:	57                   	push   %edi
  b4:	56                   	push   %esi
  b5:	53                   	push   %ebx
  b6:	81 ec 5c 02 00 00    	sub    $0x25c,%esp
	char buf[512], *p;
	int fd;
	struct dirent de;
	struct stat st;

	if((fd = open(path, 0)) < 0){
  bc:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  c3:	00 
  c4:	8b 45 08             	mov    0x8(%ebp),%eax
  c7:	89 04 24             	mov    %eax,(%esp)
  ca:	e8 0d 07 00 00       	call   7dc <open>
  cf:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  d2:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  d6:	79 20                	jns    f8 <ls+0x48>
		printf(2, "ls: cannot open %s\n", path);
  d8:	8b 45 08             	mov    0x8(%ebp),%eax
  db:	89 44 24 08          	mov    %eax,0x8(%esp)
  df:	c7 44 24 04 1c 0d 00 	movl   $0xd1c,0x4(%esp)
  e6:	00 
  e7:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  ee:	e8 56 08 00 00       	call   949 <printf>
  f3:	e9 01 02 00 00       	jmp    2f9 <ls+0x249>
		return;
	}

	if(fstat(fd, &st) < 0){
  f8:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
  fe:	89 44 24 04          	mov    %eax,0x4(%esp)
 102:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 105:	89 04 24             	mov    %eax,(%esp)
 108:	e8 e7 06 00 00       	call   7f4 <fstat>
 10d:	85 c0                	test   %eax,%eax
 10f:	79 2b                	jns    13c <ls+0x8c>
		printf(2, "ls: cannot stat %s\n", path);
 111:	8b 45 08             	mov    0x8(%ebp),%eax
 114:	89 44 24 08          	mov    %eax,0x8(%esp)
 118:	c7 44 24 04 30 0d 00 	movl   $0xd30,0x4(%esp)
 11f:	00 
 120:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
 127:	e8 1d 08 00 00       	call   949 <printf>
		close(fd);
 12c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 12f:	89 04 24             	mov    %eax,(%esp)
 132:	e8 8d 06 00 00       	call   7c4 <close>
 137:	e9 bd 01 00 00       	jmp    2f9 <ls+0x249>
		return;
	}

	switch(st.type){
 13c:	0f b7 85 bc fd ff ff 	movzwl -0x244(%ebp),%eax
 143:	98                   	cwtl   
 144:	83 f8 01             	cmp    $0x1,%eax
 147:	74 53                	je     19c <ls+0xec>
 149:	83 f8 02             	cmp    $0x2,%eax
 14c:	0f 85 9c 01 00 00    	jne    2ee <ls+0x23e>
	case T_FILE:
		printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
 152:	8b bd cc fd ff ff    	mov    -0x234(%ebp),%edi
 158:	8b b5 c4 fd ff ff    	mov    -0x23c(%ebp),%esi
 15e:	0f b7 85 bc fd ff ff 	movzwl -0x244(%ebp),%eax
 165:	0f bf d8             	movswl %ax,%ebx
 168:	8b 45 08             	mov    0x8(%ebp),%eax
 16b:	89 04 24             	mov    %eax,(%esp)
 16e:	e8 8d fe ff ff       	call   0 <fmtname>
 173:	89 7c 24 14          	mov    %edi,0x14(%esp)
 177:	89 74 24 10          	mov    %esi,0x10(%esp)
 17b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
 17f:	89 44 24 08          	mov    %eax,0x8(%esp)
 183:	c7 44 24 04 44 0d 00 	movl   $0xd44,0x4(%esp)
 18a:	00 
 18b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 192:	e8 b2 07 00 00       	call   949 <printf>
		break;
 197:	e9 52 01 00 00       	jmp    2ee <ls+0x23e>

	case T_DIR:
		if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
 19c:	8b 45 08             	mov    0x8(%ebp),%eax
 19f:	89 04 24             	mov    %eax,(%esp)
 1a2:	e8 27 04 00 00       	call   5ce <strlen>
 1a7:	83 c0 10             	add    $0x10,%eax
 1aa:	3d 00 02 00 00       	cmp    $0x200,%eax
 1af:	76 19                	jbe    1ca <ls+0x11a>
			printf(1, "ls: path too long\n");
 1b1:	c7 44 24 04 51 0d 00 	movl   $0xd51,0x4(%esp)
 1b8:	00 
 1b9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 1c0:	e8 84 07 00 00       	call   949 <printf>
			break;
 1c5:	e9 24 01 00 00       	jmp    2ee <ls+0x23e>
		}
		strcpy(buf, path);
 1ca:	8b 45 08             	mov    0x8(%ebp),%eax
 1cd:	89 44 24 04          	mov    %eax,0x4(%esp)
 1d1:	8d 85 e0 fd ff ff    	lea    -0x220(%ebp),%eax
 1d7:	89 04 24             	mov    %eax,(%esp)
 1da:	e8 7a 03 00 00       	call   559 <strcpy>
		p = buf+strlen(buf);
 1df:	8d 85 e0 fd ff ff    	lea    -0x220(%ebp),%eax
 1e5:	89 04 24             	mov    %eax,(%esp)
 1e8:	e8 e1 03 00 00       	call   5ce <strlen>
 1ed:	8d 95 e0 fd ff ff    	lea    -0x220(%ebp),%edx
 1f3:	01 d0                	add    %edx,%eax
 1f5:	89 45 e0             	mov    %eax,-0x20(%ebp)
		*p++ = '/';
 1f8:	8b 45 e0             	mov    -0x20(%ebp),%eax
 1fb:	c6 00 2f             	movb   $0x2f,(%eax)
 1fe:	83 45 e0 01          	addl   $0x1,-0x20(%ebp)
		while(read(fd, &de, sizeof(de)) == sizeof(de)){
 202:	e9 c0 00 00 00       	jmp    2c7 <ls+0x217>
			if(de.inum == 0)
 207:	0f b7 85 d0 fd ff ff 	movzwl -0x230(%ebp),%eax
 20e:	66 85 c0             	test   %ax,%ax
 211:	0f 84 af 00 00 00    	je     2c6 <ls+0x216>
				continue;
			memmove(p, de.name, DIRSIZ);
 217:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
 21e:	00 
 21f:	8d 85 d0 fd ff ff    	lea    -0x230(%ebp),%eax
 225:	83 c0 02             	add    $0x2,%eax
 228:	89 44 24 04          	mov    %eax,0x4(%esp)
 22c:	8b 45 e0             	mov    -0x20(%ebp),%eax
 22f:	89 04 24             	mov    %eax,(%esp)
 232:	e8 21 05 00 00       	call   758 <memmove>
			p[DIRSIZ] = 0;
 237:	8b 45 e0             	mov    -0x20(%ebp),%eax
 23a:	83 c0 0e             	add    $0xe,%eax
 23d:	c6 00 00             	movb   $0x0,(%eax)
			if(stat(buf, &st) < 0){
 240:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
 246:	89 44 24 04          	mov    %eax,0x4(%esp)
 24a:	8d 85 e0 fd ff ff    	lea    -0x220(%ebp),%eax
 250:	89 04 24             	mov    %eax,(%esp)
 253:	e8 67 04 00 00       	call   6bf <stat>
 258:	85 c0                	test   %eax,%eax
 25a:	79 20                	jns    27c <ls+0x1cc>
				printf(1, "ls: cannot stat %s\n", buf);
 25c:	8d 85 e0 fd ff ff    	lea    -0x220(%ebp),%eax
 262:	89 44 24 08          	mov    %eax,0x8(%esp)
 266:	c7 44 24 04 30 0d 00 	movl   $0xd30,0x4(%esp)
 26d:	00 
 26e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 275:	e8 cf 06 00 00       	call   949 <printf>
				continue;
 27a:	eb 4b                	jmp    2c7 <ls+0x217>
			}
			printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
 27c:	8b bd cc fd ff ff    	mov    -0x234(%ebp),%edi
 282:	8b b5 c4 fd ff ff    	mov    -0x23c(%ebp),%esi
 288:	0f b7 85 bc fd ff ff 	movzwl -0x244(%ebp),%eax
 28f:	0f bf d8             	movswl %ax,%ebx
 292:	8d 85 e0 fd ff ff    	lea    -0x220(%ebp),%eax
 298:	89 04 24             	mov    %eax,(%esp)
 29b:	e8 60 fd ff ff       	call   0 <fmtname>
 2a0:	89 7c 24 14          	mov    %edi,0x14(%esp)
 2a4:	89 74 24 10          	mov    %esi,0x10(%esp)
 2a8:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
 2ac:	89 44 24 08          	mov    %eax,0x8(%esp)
 2b0:	c7 44 24 04 44 0d 00 	movl   $0xd44,0x4(%esp)
 2b7:	00 
 2b8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 2bf:	e8 85 06 00 00       	call   949 <printf>
 2c4:	eb 01                	jmp    2c7 <ls+0x217>
		strcpy(buf, path);
		p = buf+strlen(buf);
		*p++ = '/';
		while(read(fd, &de, sizeof(de)) == sizeof(de)){
			if(de.inum == 0)
				continue;
 2c6:	90                   	nop
			break;
		}
		strcpy(buf, path);
		p = buf+strlen(buf);
		*p++ = '/';
		while(read(fd, &de, sizeof(de)) == sizeof(de)){
 2c7:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
 2ce:	00 
 2cf:	8d 85 d0 fd ff ff    	lea    -0x230(%ebp),%eax
 2d5:	89 44 24 04          	mov    %eax,0x4(%esp)
 2d9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 2dc:	89 04 24             	mov    %eax,(%esp)
 2df:	e8 d0 04 00 00       	call   7b4 <read>
 2e4:	83 f8 10             	cmp    $0x10,%eax
 2e7:	0f 84 1a ff ff ff    	je     207 <ls+0x157>
				printf(1, "ls: cannot stat %s\n", buf);
				continue;
			}
			printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
		}
		break;
 2ed:	90                   	nop
	}
	close(fd);
 2ee:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 2f1:	89 04 24             	mov    %eax,(%esp)
 2f4:	e8 cb 04 00 00       	call   7c4 <close>
}
 2f9:	81 c4 5c 02 00 00    	add    $0x25c,%esp
 2ff:	5b                   	pop    %ebx
 300:	5e                   	pop    %esi
 301:	5f                   	pop    %edi
 302:	5d                   	pop    %ebp
 303:	c3                   	ret    

00000304 <childRun>:

void childRun(char* buf) {
 304:	55                   	push   %ebp
 305:	89 e5                	mov    %esp,%ebp
 307:	83 ec 28             	sub    $0x28,%esp
	int  i;
	int fd = open("4.swap", 0);
 30a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 311:	00 
 312:	c7 04 24 64 0d 00 00 	movl   $0xd64,(%esp)
 319:	e8 be 04 00 00       	call   7dc <open>
 31e:	89 45 f0             	mov    %eax,-0x10(%ebp)
	read(fd, buf, 10);
 321:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
 328:	00 
 329:	8b 45 08             	mov    0x8(%ebp),%eax
 32c:	89 44 24 04          	mov    %eax,0x4(%esp)
 330:	8b 45 f0             	mov    -0x10(%ebp),%eax
 333:	89 04 24             	mov    %eax,(%esp)
 336:	e8 79 04 00 00       	call   7b4 <read>
	printf(1, "10 first bytes from father's swap file:\n");
 33b:	c7 44 24 04 6c 0d 00 	movl   $0xd6c,0x4(%esp)
 342:	00 
 343:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 34a:	e8 fa 05 00 00       	call   949 <printf>
	for (i = 1; i <= 10; i++, buf++)
 34f:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
 356:	eb 29                	jmp    381 <childRun+0x7d>
		printf(1, "%x ", (unsigned char) (*buf));
 358:	8b 45 08             	mov    0x8(%ebp),%eax
 35b:	0f b6 00             	movzbl (%eax),%eax
 35e:	0f b6 c0             	movzbl %al,%eax
 361:	89 44 24 08          	mov    %eax,0x8(%esp)
 365:	c7 44 24 04 95 0d 00 	movl   $0xd95,0x4(%esp)
 36c:	00 
 36d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 374:	e8 d0 05 00 00       	call   949 <printf>
void childRun(char* buf) {
	int  i;
	int fd = open("4.swap", 0);
	read(fd, buf, 10);
	printf(1, "10 first bytes from father's swap file:\n");
	for (i = 1; i <= 10; i++, buf++)
 379:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
 37d:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 381:	83 7d f4 0a          	cmpl   $0xa,-0xc(%ebp)
 385:	7e d1                	jle    358 <childRun+0x54>
		printf(1, "%x ", (unsigned char) (*buf));
	printf(1, "\n");
 387:	c7 44 24 04 99 0d 00 	movl   $0xd99,0x4(%esp)
 38e:	00 
 38f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 396:	e8 ae 05 00 00       	call   949 <printf>
	close(fd);
 39b:	8b 45 f0             	mov    -0x10(%ebp),%eax
 39e:	89 04 24             	mov    %eax,(%esp)
 3a1:	e8 1e 04 00 00       	call   7c4 <close>
	ls(".");
 3a6:	c7 04 24 9b 0d 00 00 	movl   $0xd9b,(%esp)
 3ad:	e8 fe fc ff ff       	call   b0 <ls>
	exit();
 3b2:	e8 e5 03 00 00       	call   79c <exit>

000003b7 <fatherRun>:
}

void fatherRun(char* buf) {
 3b7:	55                   	push   %ebp
 3b8:	89 e5                	mov    %esp,%ebp
 3ba:	83 ec 28             	sub    $0x28,%esp
	int  i;
	sleep(1000);
 3bd:	c7 04 24 e8 03 00 00 	movl   $0x3e8,(%esp)
 3c4:	e8 63 04 00 00       	call   82c <sleep>
	buf = (char*) 0;
 3c9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
	printf(1, "10 first bytes from father's memory:\n");
 3d0:	c7 44 24 04 a0 0d 00 	movl   $0xda0,0x4(%esp)
 3d7:	00 
 3d8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 3df:	e8 65 05 00 00       	call   949 <printf>
	for (i = 0; i < 10; i++, buf++)
 3e4:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
 3eb:	eb 29                	jmp    416 <fatherRun+0x5f>
		printf(1, "%x ", (unsigned char) (*buf));
 3ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
 3f0:	0f b6 00             	movzbl (%eax),%eax
 3f3:	0f b6 c0             	movzbl %al,%eax
 3f6:	89 44 24 08          	mov    %eax,0x8(%esp)
 3fa:	c7 44 24 04 95 0d 00 	movl   $0xd95,0x4(%esp)
 401:	00 
 402:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 409:	e8 3b 05 00 00       	call   949 <printf>
void fatherRun(char* buf) {
	int  i;
	sleep(1000);
	buf = (char*) 0;
	printf(1, "10 first bytes from father's memory:\n");
	for (i = 0; i < 10; i++, buf++)
 40e:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
 412:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
 416:	83 7d f0 09          	cmpl   $0x9,-0x10(%ebp)
 41a:	7e d1                	jle    3ed <fatherRun+0x36>
		printf(1, "%x ", (unsigned char) (*buf));
	printf(1, "\n");
 41c:	c7 44 24 04 99 0d 00 	movl   $0xd99,0x4(%esp)
 423:	00 
 424:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 42b:	e8 19 05 00 00       	call   949 <printf>
	wait();
 430:	e8 6f 03 00 00       	call   7a4 <wait>
}
 435:	c9                   	leave  
 436:	c3                   	ret    

00000437 <main>:

int main(void)
{
 437:	55                   	push   %ebp
 438:	89 e5                	mov    %esp,%ebp
 43a:	83 e4 f0             	and    $0xfffffff0,%esp
 43d:	83 ec 20             	sub    $0x20,%esp
	unsigned long int uint0 = (uint) 10 * sizeof(char);
 440:	c7 44 24 1c 0a 00 00 	movl   $0xa,0x1c(%esp)
 447:	00 
	printf(1,"\n\n-------------- Start Swaptest ---------------\n\n");
 448:	c7 44 24 04 c8 0d 00 	movl   $0xdc8,0x4(%esp)
 44f:	00 
 450:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 457:	e8 ed 04 00 00       	call   949 <printf>
	char *buf = malloc(uint0);
 45c:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 460:	89 04 24             	mov    %eax,(%esp)
 463:	e8 d1 07 00 00       	call   c39 <malloc>
 468:	89 44 24 18          	mov    %eax,0x18(%esp)
	printf(1,"First ls, should not include any swap files (Swapping disabled)\n");
 46c:	c7 44 24 04 fc 0d 00 	movl   $0xdfc,0x4(%esp)
 473:	00 
 474:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 47b:	e8 c9 04 00 00       	call   949 <printf>
	sleep(500);
 480:	c7 04 24 f4 01 00 00 	movl   $0x1f4,(%esp)
 487:	e8 a0 03 00 00       	call   82c <sleep>
	ls(".");
 48c:	c7 04 24 9b 0d 00 00 	movl   $0xd9b,(%esp)
 493:	e8 18 fc ff ff       	call   b0 <ls>
	printf(1,"Now enabling swapping. Next ls should include 4.swap (father's sleeping)\n");
 498:	c7 44 24 04 40 0e 00 	movl   $0xe40,0x4(%esp)
 49f:	00 
 4a0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 4a7:	e8 9d 04 00 00       	call   949 <printf>
	sleep(500);
 4ac:	c7 04 24 f4 01 00 00 	movl   $0x1f4,(%esp)
 4b3:	e8 74 03 00 00       	call   82c <sleep>
	enableSwapping();
 4b8:	e8 7f 03 00 00       	call   83c <enableSwapping>
	int fid = fork();
 4bd:	e8 d2 02 00 00       	call   794 <fork>
 4c2:	89 44 24 14          	mov    %eax,0x14(%esp)
	if (fid == 0){
 4c6:	83 7c 24 14 00       	cmpl   $0x0,0x14(%esp)
 4cb:	75 0e                	jne    4db <main+0xa4>
		childRun(buf);
 4cd:	8b 44 24 18          	mov    0x18(%esp),%eax
 4d1:	89 04 24             	mov    %eax,(%esp)
 4d4:	e8 2b fe ff ff       	call   304 <childRun>
 4d9:	eb 0c                	jmp    4e7 <main+0xb0>
	}
	else
	{
		fatherRun(buf);
 4db:	8b 44 24 18          	mov    0x18(%esp),%eax
 4df:	89 04 24             	mov    %eax,(%esp)
 4e2:	e8 d0 fe ff ff       	call   3b7 <fatherRun>
	}

	printf(1,"Now disabling swapping and sleeping. on the next ls, no swap files should appear\n");
 4e7:	c7 44 24 04 8c 0e 00 	movl   $0xe8c,0x4(%esp)
 4ee:	00 
 4ef:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 4f6:	e8 4e 04 00 00       	call   949 <printf>
	disableSwapping();
 4fb:	e8 44 03 00 00       	call   844 <disableSwapping>
	sleep(200);
 500:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
 507:	e8 20 03 00 00       	call   82c <sleep>
	ls(".");
 50c:	c7 04 24 9b 0d 00 00 	movl   $0xd9b,(%esp)
 513:	e8 98 fb ff ff       	call   b0 <ls>
	printf(1,"\n\n-------------- End Swaptest ---------------\n\n");
 518:	c7 44 24 04 e0 0e 00 	movl   $0xee0,0x4(%esp)
 51f:	00 
 520:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 527:	e8 1d 04 00 00       	call   949 <printf>
	exit();
 52c:	e8 6b 02 00 00       	call   79c <exit>
 531:	66 90                	xchg   %ax,%ax
 533:	90                   	nop

00000534 <stosb>:
               "cc");
}

static inline void
stosb(void *addr, int data, int cnt)
{
 534:	55                   	push   %ebp
 535:	89 e5                	mov    %esp,%ebp
 537:	57                   	push   %edi
 538:	53                   	push   %ebx
  asm volatile("cld; rep stosb" :
 539:	8b 4d 08             	mov    0x8(%ebp),%ecx
 53c:	8b 55 10             	mov    0x10(%ebp),%edx
 53f:	8b 45 0c             	mov    0xc(%ebp),%eax
 542:	89 cb                	mov    %ecx,%ebx
 544:	89 df                	mov    %ebx,%edi
 546:	89 d1                	mov    %edx,%ecx
 548:	fc                   	cld    
 549:	f3 aa                	rep stos %al,%es:(%edi)
 54b:	89 ca                	mov    %ecx,%edx
 54d:	89 fb                	mov    %edi,%ebx
 54f:	89 5d 08             	mov    %ebx,0x8(%ebp)
 552:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
 555:	5b                   	pop    %ebx
 556:	5f                   	pop    %edi
 557:	5d                   	pop    %ebp
 558:	c3                   	ret    

00000559 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
 559:	55                   	push   %ebp
 55a:	89 e5                	mov    %esp,%ebp
 55c:	83 ec 10             	sub    $0x10,%esp
  char *os;

  os = s;
 55f:	8b 45 08             	mov    0x8(%ebp),%eax
 562:	89 45 fc             	mov    %eax,-0x4(%ebp)
  while((*s++ = *t++) != 0)
 565:	90                   	nop
 566:	8b 45 0c             	mov    0xc(%ebp),%eax
 569:	0f b6 10             	movzbl (%eax),%edx
 56c:	8b 45 08             	mov    0x8(%ebp),%eax
 56f:	88 10                	mov    %dl,(%eax)
 571:	8b 45 08             	mov    0x8(%ebp),%eax
 574:	0f b6 00             	movzbl (%eax),%eax
 577:	84 c0                	test   %al,%al
 579:	0f 95 c0             	setne  %al
 57c:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 580:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
 584:	84 c0                	test   %al,%al
 586:	75 de                	jne    566 <strcpy+0xd>
    ;
  return os;
 588:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
 58b:	c9                   	leave  
 58c:	c3                   	ret    

0000058d <strcmp>:

int
strcmp(const char *p, const char *q)
{
 58d:	55                   	push   %ebp
 58e:	89 e5                	mov    %esp,%ebp
  while(*p && *p == *q)
 590:	eb 08                	jmp    59a <strcmp+0xd>
    p++, q++;
 592:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 596:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 59a:	8b 45 08             	mov    0x8(%ebp),%eax
 59d:	0f b6 00             	movzbl (%eax),%eax
 5a0:	84 c0                	test   %al,%al
 5a2:	74 10                	je     5b4 <strcmp+0x27>
 5a4:	8b 45 08             	mov    0x8(%ebp),%eax
 5a7:	0f b6 10             	movzbl (%eax),%edx
 5aa:	8b 45 0c             	mov    0xc(%ebp),%eax
 5ad:	0f b6 00             	movzbl (%eax),%eax
 5b0:	38 c2                	cmp    %al,%dl
 5b2:	74 de                	je     592 <strcmp+0x5>
    p++, q++;
  return (uchar)*p - (uchar)*q;
 5b4:	8b 45 08             	mov    0x8(%ebp),%eax
 5b7:	0f b6 00             	movzbl (%eax),%eax
 5ba:	0f b6 d0             	movzbl %al,%edx
 5bd:	8b 45 0c             	mov    0xc(%ebp),%eax
 5c0:	0f b6 00             	movzbl (%eax),%eax
 5c3:	0f b6 c0             	movzbl %al,%eax
 5c6:	89 d1                	mov    %edx,%ecx
 5c8:	29 c1                	sub    %eax,%ecx
 5ca:	89 c8                	mov    %ecx,%eax
}
 5cc:	5d                   	pop    %ebp
 5cd:	c3                   	ret    

000005ce <strlen>:

uint
strlen(char *s)
{
 5ce:	55                   	push   %ebp
 5cf:	89 e5                	mov    %esp,%ebp
 5d1:	83 ec 10             	sub    $0x10,%esp
  int n;

  for(n = 0; s[n]; n++)
 5d4:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
 5db:	eb 04                	jmp    5e1 <strlen+0x13>
 5dd:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 5e1:	8b 55 fc             	mov    -0x4(%ebp),%edx
 5e4:	8b 45 08             	mov    0x8(%ebp),%eax
 5e7:	01 d0                	add    %edx,%eax
 5e9:	0f b6 00             	movzbl (%eax),%eax
 5ec:	84 c0                	test   %al,%al
 5ee:	75 ed                	jne    5dd <strlen+0xf>
    ;
  return n;
 5f0:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
 5f3:	c9                   	leave  
 5f4:	c3                   	ret    

000005f5 <memset>:

void*
memset(void *dst, int c, uint n)
{
 5f5:	55                   	push   %ebp
 5f6:	89 e5                	mov    %esp,%ebp
 5f8:	83 ec 0c             	sub    $0xc,%esp
  stosb(dst, c, n);
 5fb:	8b 45 10             	mov    0x10(%ebp),%eax
 5fe:	89 44 24 08          	mov    %eax,0x8(%esp)
 602:	8b 45 0c             	mov    0xc(%ebp),%eax
 605:	89 44 24 04          	mov    %eax,0x4(%esp)
 609:	8b 45 08             	mov    0x8(%ebp),%eax
 60c:	89 04 24             	mov    %eax,(%esp)
 60f:	e8 20 ff ff ff       	call   534 <stosb>
  return dst;
 614:	8b 45 08             	mov    0x8(%ebp),%eax
}
 617:	c9                   	leave  
 618:	c3                   	ret    

00000619 <strchr>:

char*
strchr(const char *s, char c)
{
 619:	55                   	push   %ebp
 61a:	89 e5                	mov    %esp,%ebp
 61c:	83 ec 04             	sub    $0x4,%esp
 61f:	8b 45 0c             	mov    0xc(%ebp),%eax
 622:	88 45 fc             	mov    %al,-0x4(%ebp)
  for(; *s; s++)
 625:	eb 14                	jmp    63b <strchr+0x22>
    if(*s == c)
 627:	8b 45 08             	mov    0x8(%ebp),%eax
 62a:	0f b6 00             	movzbl (%eax),%eax
 62d:	3a 45 fc             	cmp    -0x4(%ebp),%al
 630:	75 05                	jne    637 <strchr+0x1e>
      return (char*)s;
 632:	8b 45 08             	mov    0x8(%ebp),%eax
 635:	eb 13                	jmp    64a <strchr+0x31>
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 637:	83 45 08 01          	addl   $0x1,0x8(%ebp)
 63b:	8b 45 08             	mov    0x8(%ebp),%eax
 63e:	0f b6 00             	movzbl (%eax),%eax
 641:	84 c0                	test   %al,%al
 643:	75 e2                	jne    627 <strchr+0xe>
    if(*s == c)
      return (char*)s;
  return 0;
 645:	b8 00 00 00 00       	mov    $0x0,%eax
}
 64a:	c9                   	leave  
 64b:	c3                   	ret    

0000064c <gets>:

char*
gets(char *buf, int max)
{
 64c:	55                   	push   %ebp
 64d:	89 e5                	mov    %esp,%ebp
 64f:	83 ec 28             	sub    $0x28,%esp
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 652:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
 659:	eb 46                	jmp    6a1 <gets+0x55>
    cc = read(0, &c, 1);
 65b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 662:	00 
 663:	8d 45 ef             	lea    -0x11(%ebp),%eax
 666:	89 44 24 04          	mov    %eax,0x4(%esp)
 66a:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 671:	e8 3e 01 00 00       	call   7b4 <read>
 676:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(cc < 1)
 679:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
 67d:	7e 2f                	jle    6ae <gets+0x62>
      break;
    buf[i++] = c;
 67f:	8b 55 f4             	mov    -0xc(%ebp),%edx
 682:	8b 45 08             	mov    0x8(%ebp),%eax
 685:	01 c2                	add    %eax,%edx
 687:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
 68b:	88 02                	mov    %al,(%edx)
 68d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
    if(c == '\n' || c == '\r')
 691:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
 695:	3c 0a                	cmp    $0xa,%al
 697:	74 16                	je     6af <gets+0x63>
 699:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
 69d:	3c 0d                	cmp    $0xd,%al
 69f:	74 0e                	je     6af <gets+0x63>
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 6a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
 6a4:	83 c0 01             	add    $0x1,%eax
 6a7:	3b 45 0c             	cmp    0xc(%ebp),%eax
 6aa:	7c af                	jl     65b <gets+0xf>
 6ac:	eb 01                	jmp    6af <gets+0x63>
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
 6ae:	90                   	nop
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
 6af:	8b 55 f4             	mov    -0xc(%ebp),%edx
 6b2:	8b 45 08             	mov    0x8(%ebp),%eax
 6b5:	01 d0                	add    %edx,%eax
 6b7:	c6 00 00             	movb   $0x0,(%eax)
  return buf;
 6ba:	8b 45 08             	mov    0x8(%ebp),%eax
}
 6bd:	c9                   	leave  
 6be:	c3                   	ret    

000006bf <stat>:

int
stat(char *n, struct stat *st)
{
 6bf:	55                   	push   %ebp
 6c0:	89 e5                	mov    %esp,%ebp
 6c2:	83 ec 28             	sub    $0x28,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 6c5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 6cc:	00 
 6cd:	8b 45 08             	mov    0x8(%ebp),%eax
 6d0:	89 04 24             	mov    %eax,(%esp)
 6d3:	e8 04 01 00 00       	call   7dc <open>
 6d8:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(fd < 0)
 6db:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
 6df:	79 07                	jns    6e8 <stat+0x29>
    return -1;
 6e1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
 6e6:	eb 23                	jmp    70b <stat+0x4c>
  r = fstat(fd, st);
 6e8:	8b 45 0c             	mov    0xc(%ebp),%eax
 6eb:	89 44 24 04          	mov    %eax,0x4(%esp)
 6ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
 6f2:	89 04 24             	mov    %eax,(%esp)
 6f5:	e8 fa 00 00 00       	call   7f4 <fstat>
 6fa:	89 45 f0             	mov    %eax,-0x10(%ebp)
  close(fd);
 6fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
 700:	89 04 24             	mov    %eax,(%esp)
 703:	e8 bc 00 00 00       	call   7c4 <close>
  return r;
 708:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
 70b:	c9                   	leave  
 70c:	c3                   	ret    

0000070d <atoi>:

int
atoi(const char *s)
{
 70d:	55                   	push   %ebp
 70e:	89 e5                	mov    %esp,%ebp
 710:	83 ec 10             	sub    $0x10,%esp
  int n;

  n = 0;
 713:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
  while('0' <= *s && *s <= '9')
 71a:	eb 23                	jmp    73f <atoi+0x32>
    n = n*10 + *s++ - '0';
 71c:	8b 55 fc             	mov    -0x4(%ebp),%edx
 71f:	89 d0                	mov    %edx,%eax
 721:	c1 e0 02             	shl    $0x2,%eax
 724:	01 d0                	add    %edx,%eax
 726:	01 c0                	add    %eax,%eax
 728:	89 c2                	mov    %eax,%edx
 72a:	8b 45 08             	mov    0x8(%ebp),%eax
 72d:	0f b6 00             	movzbl (%eax),%eax
 730:	0f be c0             	movsbl %al,%eax
 733:	01 d0                	add    %edx,%eax
 735:	83 e8 30             	sub    $0x30,%eax
 738:	89 45 fc             	mov    %eax,-0x4(%ebp)
 73b:	83 45 08 01          	addl   $0x1,0x8(%ebp)
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 73f:	8b 45 08             	mov    0x8(%ebp),%eax
 742:	0f b6 00             	movzbl (%eax),%eax
 745:	3c 2f                	cmp    $0x2f,%al
 747:	7e 0a                	jle    753 <atoi+0x46>
 749:	8b 45 08             	mov    0x8(%ebp),%eax
 74c:	0f b6 00             	movzbl (%eax),%eax
 74f:	3c 39                	cmp    $0x39,%al
 751:	7e c9                	jle    71c <atoi+0xf>
    n = n*10 + *s++ - '0';
  return n;
 753:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
 756:	c9                   	leave  
 757:	c3                   	ret    

00000758 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 758:	55                   	push   %ebp
 759:	89 e5                	mov    %esp,%ebp
 75b:	83 ec 10             	sub    $0x10,%esp
  char *dst, *src;
  
  dst = vdst;
 75e:	8b 45 08             	mov    0x8(%ebp),%eax
 761:	89 45 fc             	mov    %eax,-0x4(%ebp)
  src = vsrc;
 764:	8b 45 0c             	mov    0xc(%ebp),%eax
 767:	89 45 f8             	mov    %eax,-0x8(%ebp)
  while(n-- > 0)
 76a:	eb 13                	jmp    77f <memmove+0x27>
    *dst++ = *src++;
 76c:	8b 45 f8             	mov    -0x8(%ebp),%eax
 76f:	0f b6 10             	movzbl (%eax),%edx
 772:	8b 45 fc             	mov    -0x4(%ebp),%eax
 775:	88 10                	mov    %dl,(%eax)
 777:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 77b:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 77f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
 783:	0f 9f c0             	setg   %al
 786:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
 78a:	84 c0                	test   %al,%al
 78c:	75 de                	jne    76c <memmove+0x14>
    *dst++ = *src++;
  return vdst;
 78e:	8b 45 08             	mov    0x8(%ebp),%eax
}
 791:	c9                   	leave  
 792:	c3                   	ret    
 793:	90                   	nop

00000794 <fork>:
  name: \
    movl $SYS_ ## name, %eax; \
    int $T_SYSCALL; \
    ret

SYSCALL(fork)
 794:	b8 01 00 00 00       	mov    $0x1,%eax
 799:	cd 40                	int    $0x40
 79b:	c3                   	ret    

0000079c <exit>:
SYSCALL(exit)
 79c:	b8 02 00 00 00       	mov    $0x2,%eax
 7a1:	cd 40                	int    $0x40
 7a3:	c3                   	ret    

000007a4 <wait>:
SYSCALL(wait)
 7a4:	b8 03 00 00 00       	mov    $0x3,%eax
 7a9:	cd 40                	int    $0x40
 7ab:	c3                   	ret    

000007ac <pipe>:
SYSCALL(pipe)
 7ac:	b8 04 00 00 00       	mov    $0x4,%eax
 7b1:	cd 40                	int    $0x40
 7b3:	c3                   	ret    

000007b4 <read>:
SYSCALL(read)
 7b4:	b8 05 00 00 00       	mov    $0x5,%eax
 7b9:	cd 40                	int    $0x40
 7bb:	c3                   	ret    

000007bc <write>:
SYSCALL(write)
 7bc:	b8 10 00 00 00       	mov    $0x10,%eax
 7c1:	cd 40                	int    $0x40
 7c3:	c3                   	ret    

000007c4 <close>:
SYSCALL(close)
 7c4:	b8 15 00 00 00       	mov    $0x15,%eax
 7c9:	cd 40                	int    $0x40
 7cb:	c3                   	ret    

000007cc <kill>:
SYSCALL(kill)
 7cc:	b8 06 00 00 00       	mov    $0x6,%eax
 7d1:	cd 40                	int    $0x40
 7d3:	c3                   	ret    

000007d4 <exec>:
SYSCALL(exec)
 7d4:	b8 07 00 00 00       	mov    $0x7,%eax
 7d9:	cd 40                	int    $0x40
 7db:	c3                   	ret    

000007dc <open>:
SYSCALL(open)
 7dc:	b8 0f 00 00 00       	mov    $0xf,%eax
 7e1:	cd 40                	int    $0x40
 7e3:	c3                   	ret    

000007e4 <mknod>:
SYSCALL(mknod)
 7e4:	b8 11 00 00 00       	mov    $0x11,%eax
 7e9:	cd 40                	int    $0x40
 7eb:	c3                   	ret    

000007ec <unlink>:
SYSCALL(unlink)
 7ec:	b8 12 00 00 00       	mov    $0x12,%eax
 7f1:	cd 40                	int    $0x40
 7f3:	c3                   	ret    

000007f4 <fstat>:
SYSCALL(fstat)
 7f4:	b8 08 00 00 00       	mov    $0x8,%eax
 7f9:	cd 40                	int    $0x40
 7fb:	c3                   	ret    

000007fc <link>:
SYSCALL(link)
 7fc:	b8 13 00 00 00       	mov    $0x13,%eax
 801:	cd 40                	int    $0x40
 803:	c3                   	ret    

00000804 <mkdir>:
SYSCALL(mkdir)
 804:	b8 14 00 00 00       	mov    $0x14,%eax
 809:	cd 40                	int    $0x40
 80b:	c3                   	ret    

0000080c <chdir>:
SYSCALL(chdir)
 80c:	b8 09 00 00 00       	mov    $0x9,%eax
 811:	cd 40                	int    $0x40
 813:	c3                   	ret    

00000814 <dup>:
SYSCALL(dup)
 814:	b8 0a 00 00 00       	mov    $0xa,%eax
 819:	cd 40                	int    $0x40
 81b:	c3                   	ret    

0000081c <getpid>:
SYSCALL(getpid)
 81c:	b8 0b 00 00 00       	mov    $0xb,%eax
 821:	cd 40                	int    $0x40
 823:	c3                   	ret    

00000824 <sbrk>:
SYSCALL(sbrk)
 824:	b8 0c 00 00 00       	mov    $0xc,%eax
 829:	cd 40                	int    $0x40
 82b:	c3                   	ret    

0000082c <sleep>:
SYSCALL(sleep)
 82c:	b8 0d 00 00 00       	mov    $0xd,%eax
 831:	cd 40                	int    $0x40
 833:	c3                   	ret    

00000834 <uptime>:
SYSCALL(uptime)
 834:	b8 0e 00 00 00       	mov    $0xe,%eax
 839:	cd 40                	int    $0x40
 83b:	c3                   	ret    

0000083c <enableSwapping>:
SYSCALL(enableSwapping)
 83c:	b8 16 00 00 00       	mov    $0x16,%eax
 841:	cd 40                	int    $0x40
 843:	c3                   	ret    

00000844 <disableSwapping>:
SYSCALL(disableSwapping)
 844:	b8 17 00 00 00       	mov    $0x17,%eax
 849:	cd 40                	int    $0x40
 84b:	c3                   	ret    

0000084c <shmget>:
SYSCALL(shmget);
 84c:	b8 18 00 00 00       	mov    $0x18,%eax
 851:	cd 40                	int    $0x40
 853:	c3                   	ret    

00000854 <shmdel>:
SYSCALL(shmdel);
 854:	b8 19 00 00 00       	mov    $0x19,%eax
 859:	cd 40                	int    $0x40
 85b:	c3                   	ret    

0000085c <shmat>:
SYSCALL(shmat);
 85c:	b8 1a 00 00 00       	mov    $0x1a,%eax
 861:	cd 40                	int    $0x40
 863:	c3                   	ret    

00000864 <shmdt>:
SYSCALL(shmdt);
 864:	b8 1b 00 00 00       	mov    $0x1b,%eax
 869:	cd 40                	int    $0x40
 86b:	c3                   	ret    

0000086c <putc>:
#include "stat.h"
#include "user.h"

static void
putc(int fd, char c)
{
 86c:	55                   	push   %ebp
 86d:	89 e5                	mov    %esp,%ebp
 86f:	83 ec 28             	sub    $0x28,%esp
 872:	8b 45 0c             	mov    0xc(%ebp),%eax
 875:	88 45 f4             	mov    %al,-0xc(%ebp)
  write(fd, &c, 1);
 878:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 87f:	00 
 880:	8d 45 f4             	lea    -0xc(%ebp),%eax
 883:	89 44 24 04          	mov    %eax,0x4(%esp)
 887:	8b 45 08             	mov    0x8(%ebp),%eax
 88a:	89 04 24             	mov    %eax,(%esp)
 88d:	e8 2a ff ff ff       	call   7bc <write>
}
 892:	c9                   	leave  
 893:	c3                   	ret    

00000894 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 894:	55                   	push   %ebp
 895:	89 e5                	mov    %esp,%ebp
 897:	83 ec 48             	sub    $0x48,%esp
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
 89a:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  if(sgn && xx < 0){
 8a1:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
 8a5:	74 17                	je     8be <printint+0x2a>
 8a7:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
 8ab:	79 11                	jns    8be <printint+0x2a>
    neg = 1;
 8ad:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
    x = -xx;
 8b4:	8b 45 0c             	mov    0xc(%ebp),%eax
 8b7:	f7 d8                	neg    %eax
 8b9:	89 45 ec             	mov    %eax,-0x14(%ebp)
 8bc:	eb 06                	jmp    8c4 <printint+0x30>
  } else {
    x = xx;
 8be:	8b 45 0c             	mov    0xc(%ebp),%eax
 8c1:	89 45 ec             	mov    %eax,-0x14(%ebp)
  }

  i = 0;
 8c4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  do{
    buf[i++] = digits[x % base];
 8cb:	8b 4d 10             	mov    0x10(%ebp),%ecx
 8ce:	8b 45 ec             	mov    -0x14(%ebp),%eax
 8d1:	ba 00 00 00 00       	mov    $0x0,%edx
 8d6:	f7 f1                	div    %ecx
 8d8:	89 d0                	mov    %edx,%eax
 8da:	0f b6 80 e4 11 00 00 	movzbl 0x11e4(%eax),%eax
 8e1:	8d 4d dc             	lea    -0x24(%ebp),%ecx
 8e4:	8b 55 f4             	mov    -0xc(%ebp),%edx
 8e7:	01 ca                	add    %ecx,%edx
 8e9:	88 02                	mov    %al,(%edx)
 8eb:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  }while((x /= base) != 0);
 8ef:	8b 55 10             	mov    0x10(%ebp),%edx
 8f2:	89 55 d4             	mov    %edx,-0x2c(%ebp)
 8f5:	8b 45 ec             	mov    -0x14(%ebp),%eax
 8f8:	ba 00 00 00 00       	mov    $0x0,%edx
 8fd:	f7 75 d4             	divl   -0x2c(%ebp)
 900:	89 45 ec             	mov    %eax,-0x14(%ebp)
 903:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
 907:	75 c2                	jne    8cb <printint+0x37>
  if(neg)
 909:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
 90d:	74 2e                	je     93d <printint+0xa9>
    buf[i++] = '-';
 90f:	8d 55 dc             	lea    -0x24(%ebp),%edx
 912:	8b 45 f4             	mov    -0xc(%ebp),%eax
 915:	01 d0                	add    %edx,%eax
 917:	c6 00 2d             	movb   $0x2d,(%eax)
 91a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)

  while(--i >= 0)
 91e:	eb 1d                	jmp    93d <printint+0xa9>
    putc(fd, buf[i]);
 920:	8d 55 dc             	lea    -0x24(%ebp),%edx
 923:	8b 45 f4             	mov    -0xc(%ebp),%eax
 926:	01 d0                	add    %edx,%eax
 928:	0f b6 00             	movzbl (%eax),%eax
 92b:	0f be c0             	movsbl %al,%eax
 92e:	89 44 24 04          	mov    %eax,0x4(%esp)
 932:	8b 45 08             	mov    0x8(%ebp),%eax
 935:	89 04 24             	mov    %eax,(%esp)
 938:	e8 2f ff ff ff       	call   86c <putc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 93d:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
 941:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
 945:	79 d9                	jns    920 <printint+0x8c>
    putc(fd, buf[i]);
}
 947:	c9                   	leave  
 948:	c3                   	ret    

00000949 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 949:	55                   	push   %ebp
 94a:	89 e5                	mov    %esp,%ebp
 94c:	83 ec 38             	sub    $0x38,%esp
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
 94f:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  ap = (uint*)(void*)&fmt + 1;
 956:	8d 45 0c             	lea    0xc(%ebp),%eax
 959:	83 c0 04             	add    $0x4,%eax
 95c:	89 45 e8             	mov    %eax,-0x18(%ebp)
  for(i = 0; fmt[i]; i++){
 95f:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
 966:	e9 7d 01 00 00       	jmp    ae8 <printf+0x19f>
    c = fmt[i] & 0xff;
 96b:	8b 55 0c             	mov    0xc(%ebp),%edx
 96e:	8b 45 f0             	mov    -0x10(%ebp),%eax
 971:	01 d0                	add    %edx,%eax
 973:	0f b6 00             	movzbl (%eax),%eax
 976:	0f be c0             	movsbl %al,%eax
 979:	25 ff 00 00 00       	and    $0xff,%eax
 97e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    if(state == 0){
 981:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
 985:	75 2c                	jne    9b3 <printf+0x6a>
      if(c == '%'){
 987:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
 98b:	75 0c                	jne    999 <printf+0x50>
        state = '%';
 98d:	c7 45 ec 25 00 00 00 	movl   $0x25,-0x14(%ebp)
 994:	e9 4b 01 00 00       	jmp    ae4 <printf+0x19b>
      } else {
        putc(fd, c);
 999:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 99c:	0f be c0             	movsbl %al,%eax
 99f:	89 44 24 04          	mov    %eax,0x4(%esp)
 9a3:	8b 45 08             	mov    0x8(%ebp),%eax
 9a6:	89 04 24             	mov    %eax,(%esp)
 9a9:	e8 be fe ff ff       	call   86c <putc>
 9ae:	e9 31 01 00 00       	jmp    ae4 <printf+0x19b>
      }
    } else if(state == '%'){
 9b3:	83 7d ec 25          	cmpl   $0x25,-0x14(%ebp)
 9b7:	0f 85 27 01 00 00    	jne    ae4 <printf+0x19b>
      if(c == 'd'){
 9bd:	83 7d e4 64          	cmpl   $0x64,-0x1c(%ebp)
 9c1:	75 2d                	jne    9f0 <printf+0xa7>
        printint(fd, *ap, 10, 1);
 9c3:	8b 45 e8             	mov    -0x18(%ebp),%eax
 9c6:	8b 00                	mov    (%eax),%eax
 9c8:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
 9cf:	00 
 9d0:	c7 44 24 08 0a 00 00 	movl   $0xa,0x8(%esp)
 9d7:	00 
 9d8:	89 44 24 04          	mov    %eax,0x4(%esp)
 9dc:	8b 45 08             	mov    0x8(%ebp),%eax
 9df:	89 04 24             	mov    %eax,(%esp)
 9e2:	e8 ad fe ff ff       	call   894 <printint>
        ap++;
 9e7:	83 45 e8 04          	addl   $0x4,-0x18(%ebp)
 9eb:	e9 ed 00 00 00       	jmp    add <printf+0x194>
      } else if(c == 'x' || c == 'p'){
 9f0:	83 7d e4 78          	cmpl   $0x78,-0x1c(%ebp)
 9f4:	74 06                	je     9fc <printf+0xb3>
 9f6:	83 7d e4 70          	cmpl   $0x70,-0x1c(%ebp)
 9fa:	75 2d                	jne    a29 <printf+0xe0>
        printint(fd, *ap, 16, 0);
 9fc:	8b 45 e8             	mov    -0x18(%ebp),%eax
 9ff:	8b 00                	mov    (%eax),%eax
 a01:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
 a08:	00 
 a09:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
 a10:	00 
 a11:	89 44 24 04          	mov    %eax,0x4(%esp)
 a15:	8b 45 08             	mov    0x8(%ebp),%eax
 a18:	89 04 24             	mov    %eax,(%esp)
 a1b:	e8 74 fe ff ff       	call   894 <printint>
        ap++;
 a20:	83 45 e8 04          	addl   $0x4,-0x18(%ebp)
 a24:	e9 b4 00 00 00       	jmp    add <printf+0x194>
      } else if(c == 's'){
 a29:	83 7d e4 73          	cmpl   $0x73,-0x1c(%ebp)
 a2d:	75 46                	jne    a75 <printf+0x12c>
        s = (char*)*ap;
 a2f:	8b 45 e8             	mov    -0x18(%ebp),%eax
 a32:	8b 00                	mov    (%eax),%eax
 a34:	89 45 f4             	mov    %eax,-0xc(%ebp)
        ap++;
 a37:	83 45 e8 04          	addl   $0x4,-0x18(%ebp)
        if(s == 0)
 a3b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
 a3f:	75 27                	jne    a68 <printf+0x11f>
          s = "(null)";
 a41:	c7 45 f4 10 0f 00 00 	movl   $0xf10,-0xc(%ebp)
        while(*s != 0){
 a48:	eb 1e                	jmp    a68 <printf+0x11f>
          putc(fd, *s);
 a4a:	8b 45 f4             	mov    -0xc(%ebp),%eax
 a4d:	0f b6 00             	movzbl (%eax),%eax
 a50:	0f be c0             	movsbl %al,%eax
 a53:	89 44 24 04          	mov    %eax,0x4(%esp)
 a57:	8b 45 08             	mov    0x8(%ebp),%eax
 a5a:	89 04 24             	mov    %eax,(%esp)
 a5d:	e8 0a fe ff ff       	call   86c <putc>
          s++;
 a62:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
 a66:	eb 01                	jmp    a69 <printf+0x120>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 a68:	90                   	nop
 a69:	8b 45 f4             	mov    -0xc(%ebp),%eax
 a6c:	0f b6 00             	movzbl (%eax),%eax
 a6f:	84 c0                	test   %al,%al
 a71:	75 d7                	jne    a4a <printf+0x101>
 a73:	eb 68                	jmp    add <printf+0x194>
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 a75:	83 7d e4 63          	cmpl   $0x63,-0x1c(%ebp)
 a79:	75 1d                	jne    a98 <printf+0x14f>
        putc(fd, *ap);
 a7b:	8b 45 e8             	mov    -0x18(%ebp),%eax
 a7e:	8b 00                	mov    (%eax),%eax
 a80:	0f be c0             	movsbl %al,%eax
 a83:	89 44 24 04          	mov    %eax,0x4(%esp)
 a87:	8b 45 08             	mov    0x8(%ebp),%eax
 a8a:	89 04 24             	mov    %eax,(%esp)
 a8d:	e8 da fd ff ff       	call   86c <putc>
        ap++;
 a92:	83 45 e8 04          	addl   $0x4,-0x18(%ebp)
 a96:	eb 45                	jmp    add <printf+0x194>
      } else if(c == '%'){
 a98:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
 a9c:	75 17                	jne    ab5 <printf+0x16c>
        putc(fd, c);
 a9e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 aa1:	0f be c0             	movsbl %al,%eax
 aa4:	89 44 24 04          	mov    %eax,0x4(%esp)
 aa8:	8b 45 08             	mov    0x8(%ebp),%eax
 aab:	89 04 24             	mov    %eax,(%esp)
 aae:	e8 b9 fd ff ff       	call   86c <putc>
 ab3:	eb 28                	jmp    add <printf+0x194>
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 ab5:	c7 44 24 04 25 00 00 	movl   $0x25,0x4(%esp)
 abc:	00 
 abd:	8b 45 08             	mov    0x8(%ebp),%eax
 ac0:	89 04 24             	mov    %eax,(%esp)
 ac3:	e8 a4 fd ff ff       	call   86c <putc>
        putc(fd, c);
 ac8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
 acb:	0f be c0             	movsbl %al,%eax
 ace:	89 44 24 04          	mov    %eax,0x4(%esp)
 ad2:	8b 45 08             	mov    0x8(%ebp),%eax
 ad5:	89 04 24             	mov    %eax,(%esp)
 ad8:	e8 8f fd ff ff       	call   86c <putc>
      }
      state = 0;
 add:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 ae4:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
 ae8:	8b 55 0c             	mov    0xc(%ebp),%edx
 aeb:	8b 45 f0             	mov    -0x10(%ebp),%eax
 aee:	01 d0                	add    %edx,%eax
 af0:	0f b6 00             	movzbl (%eax),%eax
 af3:	84 c0                	test   %al,%al
 af5:	0f 85 70 fe ff ff    	jne    96b <printf+0x22>
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 afb:	c9                   	leave  
 afc:	c3                   	ret    
 afd:	66 90                	xchg   %ax,%ax
 aff:	90                   	nop

00000b00 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 b00:	55                   	push   %ebp
 b01:	89 e5                	mov    %esp,%ebp
 b03:	83 ec 10             	sub    $0x10,%esp
  Header *bp, *p;

  bp = (Header*)ap - 1;
 b06:	8b 45 08             	mov    0x8(%ebp),%eax
 b09:	83 e8 08             	sub    $0x8,%eax
 b0c:	89 45 f8             	mov    %eax,-0x8(%ebp)
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b0f:	a1 10 12 00 00       	mov    0x1210,%eax
 b14:	89 45 fc             	mov    %eax,-0x4(%ebp)
 b17:	eb 24                	jmp    b3d <free+0x3d>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 b19:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b1c:	8b 00                	mov    (%eax),%eax
 b1e:	3b 45 fc             	cmp    -0x4(%ebp),%eax
 b21:	77 12                	ja     b35 <free+0x35>
 b23:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b26:	3b 45 fc             	cmp    -0x4(%ebp),%eax
 b29:	77 24                	ja     b4f <free+0x4f>
 b2b:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b2e:	8b 00                	mov    (%eax),%eax
 b30:	3b 45 f8             	cmp    -0x8(%ebp),%eax
 b33:	77 1a                	ja     b4f <free+0x4f>
free(void *ap)
{
  Header *bp, *p;

  bp = (Header*)ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b35:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b38:	8b 00                	mov    (%eax),%eax
 b3a:	89 45 fc             	mov    %eax,-0x4(%ebp)
 b3d:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b40:	3b 45 fc             	cmp    -0x4(%ebp),%eax
 b43:	76 d4                	jbe    b19 <free+0x19>
 b45:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b48:	8b 00                	mov    (%eax),%eax
 b4a:	3b 45 f8             	cmp    -0x8(%ebp),%eax
 b4d:	76 ca                	jbe    b19 <free+0x19>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
 b4f:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b52:	8b 40 04             	mov    0x4(%eax),%eax
 b55:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
 b5c:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b5f:	01 c2                	add    %eax,%edx
 b61:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b64:	8b 00                	mov    (%eax),%eax
 b66:	39 c2                	cmp    %eax,%edx
 b68:	75 24                	jne    b8e <free+0x8e>
    bp->s.size += p->s.ptr->s.size;
 b6a:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b6d:	8b 50 04             	mov    0x4(%eax),%edx
 b70:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b73:	8b 00                	mov    (%eax),%eax
 b75:	8b 40 04             	mov    0x4(%eax),%eax
 b78:	01 c2                	add    %eax,%edx
 b7a:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b7d:	89 50 04             	mov    %edx,0x4(%eax)
    bp->s.ptr = p->s.ptr->s.ptr;
 b80:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b83:	8b 00                	mov    (%eax),%eax
 b85:	8b 10                	mov    (%eax),%edx
 b87:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b8a:	89 10                	mov    %edx,(%eax)
 b8c:	eb 0a                	jmp    b98 <free+0x98>
  } else
    bp->s.ptr = p->s.ptr;
 b8e:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b91:	8b 10                	mov    (%eax),%edx
 b93:	8b 45 f8             	mov    -0x8(%ebp),%eax
 b96:	89 10                	mov    %edx,(%eax)
  if(p + p->s.size == bp){
 b98:	8b 45 fc             	mov    -0x4(%ebp),%eax
 b9b:	8b 40 04             	mov    0x4(%eax),%eax
 b9e:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
 ba5:	8b 45 fc             	mov    -0x4(%ebp),%eax
 ba8:	01 d0                	add    %edx,%eax
 baa:	3b 45 f8             	cmp    -0x8(%ebp),%eax
 bad:	75 20                	jne    bcf <free+0xcf>
    p->s.size += bp->s.size;
 baf:	8b 45 fc             	mov    -0x4(%ebp),%eax
 bb2:	8b 50 04             	mov    0x4(%eax),%edx
 bb5:	8b 45 f8             	mov    -0x8(%ebp),%eax
 bb8:	8b 40 04             	mov    0x4(%eax),%eax
 bbb:	01 c2                	add    %eax,%edx
 bbd:	8b 45 fc             	mov    -0x4(%ebp),%eax
 bc0:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
 bc3:	8b 45 f8             	mov    -0x8(%ebp),%eax
 bc6:	8b 10                	mov    (%eax),%edx
 bc8:	8b 45 fc             	mov    -0x4(%ebp),%eax
 bcb:	89 10                	mov    %edx,(%eax)
 bcd:	eb 08                	jmp    bd7 <free+0xd7>
  } else
    p->s.ptr = bp;
 bcf:	8b 45 fc             	mov    -0x4(%ebp),%eax
 bd2:	8b 55 f8             	mov    -0x8(%ebp),%edx
 bd5:	89 10                	mov    %edx,(%eax)
  freep = p;
 bd7:	8b 45 fc             	mov    -0x4(%ebp),%eax
 bda:	a3 10 12 00 00       	mov    %eax,0x1210
}
 bdf:	c9                   	leave  
 be0:	c3                   	ret    

00000be1 <morecore>:

static Header*
morecore(uint nu)
{
 be1:	55                   	push   %ebp
 be2:	89 e5                	mov    %esp,%ebp
 be4:	83 ec 28             	sub    $0x28,%esp
  char *p;
  Header *hp;

  if(nu < 4096)
 be7:	81 7d 08 ff 0f 00 00 	cmpl   $0xfff,0x8(%ebp)
 bee:	77 07                	ja     bf7 <morecore+0x16>
    nu = 4096;
 bf0:	c7 45 08 00 10 00 00 	movl   $0x1000,0x8(%ebp)
  p = sbrk(nu * sizeof(Header));
 bf7:	8b 45 08             	mov    0x8(%ebp),%eax
 bfa:	c1 e0 03             	shl    $0x3,%eax
 bfd:	89 04 24             	mov    %eax,(%esp)
 c00:	e8 1f fc ff ff       	call   824 <sbrk>
 c05:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(p == (char*)-1)
 c08:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
 c0c:	75 07                	jne    c15 <morecore+0x34>
    return 0;
 c0e:	b8 00 00 00 00       	mov    $0x0,%eax
 c13:	eb 22                	jmp    c37 <morecore+0x56>
  hp = (Header*)p;
 c15:	8b 45 f4             	mov    -0xc(%ebp),%eax
 c18:	89 45 f0             	mov    %eax,-0x10(%ebp)
  hp->s.size = nu;
 c1b:	8b 45 f0             	mov    -0x10(%ebp),%eax
 c1e:	8b 55 08             	mov    0x8(%ebp),%edx
 c21:	89 50 04             	mov    %edx,0x4(%eax)
  free((void*)(hp + 1));
 c24:	8b 45 f0             	mov    -0x10(%ebp),%eax
 c27:	83 c0 08             	add    $0x8,%eax
 c2a:	89 04 24             	mov    %eax,(%esp)
 c2d:	e8 ce fe ff ff       	call   b00 <free>
  return freep;
 c32:	a1 10 12 00 00       	mov    0x1210,%eax
}
 c37:	c9                   	leave  
 c38:	c3                   	ret    

00000c39 <malloc>:

void*
malloc(uint nbytes)
{
 c39:	55                   	push   %ebp
 c3a:	89 e5                	mov    %esp,%ebp
 c3c:	83 ec 28             	sub    $0x28,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 c3f:	8b 45 08             	mov    0x8(%ebp),%eax
 c42:	83 c0 07             	add    $0x7,%eax
 c45:	c1 e8 03             	shr    $0x3,%eax
 c48:	83 c0 01             	add    $0x1,%eax
 c4b:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if((prevp = freep) == 0){
 c4e:	a1 10 12 00 00       	mov    0x1210,%eax
 c53:	89 45 f0             	mov    %eax,-0x10(%ebp)
 c56:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
 c5a:	75 23                	jne    c7f <malloc+0x46>
    base.s.ptr = freep = prevp = &base;
 c5c:	c7 45 f0 08 12 00 00 	movl   $0x1208,-0x10(%ebp)
 c63:	8b 45 f0             	mov    -0x10(%ebp),%eax
 c66:	a3 10 12 00 00       	mov    %eax,0x1210
 c6b:	a1 10 12 00 00       	mov    0x1210,%eax
 c70:	a3 08 12 00 00       	mov    %eax,0x1208
    base.s.size = 0;
 c75:	c7 05 0c 12 00 00 00 	movl   $0x0,0x120c
 c7c:	00 00 00 
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 c7f:	8b 45 f0             	mov    -0x10(%ebp),%eax
 c82:	8b 00                	mov    (%eax),%eax
 c84:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if(p->s.size >= nunits){
 c87:	8b 45 f4             	mov    -0xc(%ebp),%eax
 c8a:	8b 40 04             	mov    0x4(%eax),%eax
 c8d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
 c90:	72 4d                	jb     cdf <malloc+0xa6>
      if(p->s.size == nunits)
 c92:	8b 45 f4             	mov    -0xc(%ebp),%eax
 c95:	8b 40 04             	mov    0x4(%eax),%eax
 c98:	3b 45 ec             	cmp    -0x14(%ebp),%eax
 c9b:	75 0c                	jne    ca9 <malloc+0x70>
        prevp->s.ptr = p->s.ptr;
 c9d:	8b 45 f4             	mov    -0xc(%ebp),%eax
 ca0:	8b 10                	mov    (%eax),%edx
 ca2:	8b 45 f0             	mov    -0x10(%ebp),%eax
 ca5:	89 10                	mov    %edx,(%eax)
 ca7:	eb 26                	jmp    ccf <malloc+0x96>
      else {
        p->s.size -= nunits;
 ca9:	8b 45 f4             	mov    -0xc(%ebp),%eax
 cac:	8b 40 04             	mov    0x4(%eax),%eax
 caf:	89 c2                	mov    %eax,%edx
 cb1:	2b 55 ec             	sub    -0x14(%ebp),%edx
 cb4:	8b 45 f4             	mov    -0xc(%ebp),%eax
 cb7:	89 50 04             	mov    %edx,0x4(%eax)
        p += p->s.size;
 cba:	8b 45 f4             	mov    -0xc(%ebp),%eax
 cbd:	8b 40 04             	mov    0x4(%eax),%eax
 cc0:	c1 e0 03             	shl    $0x3,%eax
 cc3:	01 45 f4             	add    %eax,-0xc(%ebp)
        p->s.size = nunits;
 cc6:	8b 45 f4             	mov    -0xc(%ebp),%eax
 cc9:	8b 55 ec             	mov    -0x14(%ebp),%edx
 ccc:	89 50 04             	mov    %edx,0x4(%eax)
      }
      freep = prevp;
 ccf:	8b 45 f0             	mov    -0x10(%ebp),%eax
 cd2:	a3 10 12 00 00       	mov    %eax,0x1210
      return (void*)(p + 1);
 cd7:	8b 45 f4             	mov    -0xc(%ebp),%eax
 cda:	83 c0 08             	add    $0x8,%eax
 cdd:	eb 38                	jmp    d17 <malloc+0xde>
    }
    if(p == freep)
 cdf:	a1 10 12 00 00       	mov    0x1210,%eax
 ce4:	39 45 f4             	cmp    %eax,-0xc(%ebp)
 ce7:	75 1b                	jne    d04 <malloc+0xcb>
      if((p = morecore(nunits)) == 0)
 ce9:	8b 45 ec             	mov    -0x14(%ebp),%eax
 cec:	89 04 24             	mov    %eax,(%esp)
 cef:	e8 ed fe ff ff       	call   be1 <morecore>
 cf4:	89 45 f4             	mov    %eax,-0xc(%ebp)
 cf7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
 cfb:	75 07                	jne    d04 <malloc+0xcb>
        return 0;
 cfd:	b8 00 00 00 00       	mov    $0x0,%eax
 d02:	eb 13                	jmp    d17 <malloc+0xde>
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 d04:	8b 45 f4             	mov    -0xc(%ebp),%eax
 d07:	89 45 f0             	mov    %eax,-0x10(%ebp)
 d0a:	8b 45 f4             	mov    -0xc(%ebp),%eax
 d0d:	8b 00                	mov    (%eax),%eax
 d0f:	89 45 f4             	mov    %eax,-0xc(%ebp)
      return (void*)(p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
 d12:	e9 70 ff ff ff       	jmp    c87 <malloc+0x4e>
}
 d17:	c9                   	leave  
 d18:	c3                   	ret    
